
#pragma once

#include <iostream>
#include <QPushButton>
#include <QWidget>

class CommonButton : public QPushButton{
public:
  CommonButton() : QPushButton() {
  }
  CommonButton(QWidget* qw) : QPushButton(qw) {
    this->resize(qw->size());
  }

  void focusInEvent(QFocusEvent *e) override{
    this->setStyleSheet("background-color: rgb(255,255,0);");
  }

  void	focusOutEvent(QFocusEvent *e) override{
    this->setStyleSheet("background-color: rgb(255,255,255);");
  }

  void enterEvent(QEnterEvent *event){
    if(this->isEnabled())
      this->setStyleSheet("background-color: rgb(255,255,0);");
  }

  void leaveEvent(QEvent *event){
    if(event->type() == QEvent::Leave){
      this->setStyleSheet("background-color: rgb(255,255,255);");
    }
  }
};
